﻿using UnityEngine;
using System.Collections;

public class B_Fechar : MonoBehaviour {

int id = 88;
	
	void Awake()
	{
		this.transform.Translate(5.0f,4.5f,0.0f);
		this.gameObject.AddComponent("MeshRenderer");
		this.gameObject.AddComponent("MeshFilter");
	}
	
	void Start () 
	{	
		Mesh mesh = Quad.Create(1.3f, 0.358f);
		
		this.gameObject.GetComponent<MeshFilter>().mesh = mesh;
		this.gameObject.GetComponent<MeshRenderer>().material = AtlasManager.globalMaterial;
		
		this.gameObject.GetComponent<MeshFilter>().mesh.uv = new Vector2[]
		{
			new Vector2(AtlasManager.rects[id].xMin, AtlasManager.rects[id].yMax),
			new Vector2(AtlasManager.rects[id].xMax, AtlasManager.rects[id].yMax),
			new Vector2(AtlasManager.rects[id].xMax, AtlasManager.rects[id].yMin),
			new Vector2(AtlasManager.rects[id].xMin, AtlasManager.rects[id].yMin)
		};
	}
	
	void Update () {
	
	}
	
	void OnMouseEnter()
	{
		id = 89;
		Start();
	}
	
	void OnMouseExit()
	{
		id = 88;
		Start ();
	}
	
	
	void OnMouseUp()
	{
		Application.LoadLevel("Menu");
	}
}
